<?php
/**
 * Created by PhpStorm.
 * User: sosyuki
 * Date: 2018/6/22
 * Time: 15:04
 */

namespace Drupal\wx_pay_refund\Entity;


use Entity;

class WxPayRefundRecord extends Entity {

  public $appid;

  public $mch_id;

  public $wx_pay_transaction;

  public $total_fee;

  public $refund_fee;

  public $op_user_id;

  public $out_refund_no;

  public $refund_id;

  public $id;

  public $module;

  public $attach;

  public $uid = 0;

  public $refund_reason;

  public $status = 0;

  public $created;

  public $return_code;

  public $return_msg;

  public $result_code;

  public $err_code;

  public $err_code_des;

  public function __construct($values = []) {
    parent::__construct($values, 'wx_pay_refund_record');
  }

  function save() {
    global $user;
    $this->op_user_id = $user->uid;
    $this->created = REQUEST_TIME;
    if ($this->result_code == 'SUCCESS') {
      $this->status = 1;
    }
    parent::save();
  }
}
